package com.cosina.game.robodefence.core.impl;

import android.graphics.Point;

import com.cosina.game.robodefence.core.BattleField;
import com.cosina.game.robodefence.dao.MapsDao;
import com.cosina.game.robodefence.model.Way;

public class BattleFieldImpl extends BattleField {
	protected final Way[] ways;
	
	public BattleFieldImpl(int mapId){
		int[][] wayData = MapsDao.getWayDataById(mapId);
		int waySize = wayData[0].length/2;
		
		ways = new Way[waySize];
		
		for(int i=0; i<waySize; i++){
			Point entry = new Point(wayData[0][i*2],wayData[0][i*2 + 1]);
			Point exit = new Point(wayData[1][i*2],wayData[1][i*2 + 1]);
			ways[i] = new Way(entry,exit,this);
		}
	}
	
	public final Way[] getWay() {
		return ways;
	}
}
